import request from '@/utils/request'

export const getRolesAPI = (params) => {
  return request({ url: '/sys/role', params })
}

export const addRoleAPI = (data) => {
  return request({ url: '/sys/role', method: 'post', data })
}

export const upDateRoleAPI = (data) => {
  return request({
    url: '/sys/role/' + data.id,
    method: 'put',
    data
  })
}

export const delRoleAPI = (id) => {
  return request({
    url: '/sys/role/' + id,
    method: 'delete'

  })
}

export const getEnableRoleAPI = () => {
  return request({ url: '/sys/role/list/enabled' })
}
export const assignRoleAPI = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}

export const getEmployeeDetailAPI = (id) => {
  return request({
    url: `/sys/user/${id}` })
}

export const assignPermAPI = (data) => {
  return request({ url: '/sys/role/assignPrem', method: 'put', data })
}
